

using System;
using System.Collections.Generic;
using System.Text;
using DataAccessLayer;
using EntityLayer;
using DataLayer;
using System.Data;
using InfraStructureLayer;

namespace BusinessLayer
{
	public class busComments:BusinessBase
	{
		public busComments() : base()
		{
		}
		#region  Code Factory Generated Methods
		public void DeleteCommentsByCommentId(entComments parEntComments)
		{
				DbConnector insDbConnector = new DbConnector();
			try
			{
				datComments insDatComments = new datComments();
				insDatComments.DeleteCommentsByCommentId(parEntComments, insDbConnector);
			}
			catch (SFException ex)
			{
				this.ErrorMessage=ex.Message;
			}
		}
		public void InsertComments(entComments parEntComments)
		{
			datComments insDatComments=null;
				DbConnector insDbConnector = new DbConnector();
			try
			{
				insDatComments = new datComments();
				insDatComments.InsertComments(parEntComments, insDbConnector);

                datEntryContents insDatEntryContents = new datEntryContents();
                entEntryContents insEntEntryContents = new entEntryContents();
                insEntEntryContents.EntryContentId = parEntComments.EntryContentId;
                insDatEntryContents.SelectEntryContentsByEntryContentId(insEntEntryContents, insDbConnector);

                object[] mailParams = new object[] { insEntEntryContents.Title, parEntComments.CommentUserName, parEntComments.CommentBody };
                busMails insBusMails = new busMails();
                insBusMails.SendMail(2, mailParams);
			}
			catch (SFException ex)
			{
				this.ErrorMessage=ex.Message;
			}
		}
		#endregion
        public DataTable SelectCommentsByEntryContentId(entComments parEntComments)
        {
            DbConnector insDbConnector = new DbConnector();
            try
            {
                datComments insDatComments = new datComments();
                return insDatComments.SelectCommentsByEntryContentId(parEntComments, insDbConnector);
            }
            catch (SFException ex)
            {
                this.ErrorMessage = ex.Message;
            }
            return null;
        }
	}
}